package org.jeecg.modules.friends.momentspics.service.impl;

import java.util.List;

import org.jeecg.modules.friends.momentspics.entity.MomentsPics;
import org.jeecg.modules.friends.momentspics.mapper.MomentsPicsMapper;
import org.jeecg.modules.friends.momentspics.service.IMomentsPicsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


/**
 * @Description: 动态信息图片表
 * @Author: jeecg-boot
 * @Date:   2024-05-15
 * @Version: V1.0
 */
@Service
public class MomentsPicsServiceImpl extends ServiceImpl<MomentsPicsMapper, MomentsPics> implements IMomentsPicsService {
    @Autowired
    private MomentsPicsMapper momentsPicsMapper;

    @Override
    public List<MomentsPics> selectByMomentsId(Long id) {
        LambdaQueryWrapper<MomentsPics> momentsPicsLambdaQueryWrapper = new LambdaQueryWrapper<>();
        momentsPicsLambdaQueryWrapper.eq(MomentsPics::getMomentsId, id);
        List<MomentsPics> momentsPicsList = momentsPicsMapper.selectList(momentsPicsLambdaQueryWrapper);
        return momentsPicsList;
    }

    @Override
    public List<MomentsPics> selectByMomentsIds(List<Long> momentIds) {
        LambdaQueryWrapper<MomentsPics> momentsPicsLambdaQueryWrapper = new LambdaQueryWrapper<>();
        momentsPicsLambdaQueryWrapper.in(MomentsPics::getMomentsId, momentIds);
        List<MomentsPics> momentsPicsList = momentsPicsMapper.selectList(momentsPicsLambdaQueryWrapper);
        return momentsPicsList;
    }

    @Override
    public void removeByMomentsId(Long momentsId) {
        LambdaQueryWrapper<MomentsPics> momentsPicsLambdaQueryWrapper = new LambdaQueryWrapper<>();
        momentsPicsLambdaQueryWrapper.eq(MomentsPics::getMomentsId, momentsId);
        momentsPicsMapper.delete(momentsPicsLambdaQueryWrapper);
    }


}
